package org.snail.attendence.bean;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.snail.config.CustomDateSerializer;
import org.snail.config.CustomDateSerializerList;

import java.util.Date;
import java.util.List;

/**
 * 累积核算考勤所需的参数
 */
@Data
public class AttendanceCheckDO {
    private Integer id;    //主键
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date startCountTime;      //开始核算时间
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date endCountTime;           //结算截止时间
    private Integer empId;           //人员id
    private Integer countId;         //attendence_count 的主键
    private Double weekOverHour;     //工作日加班
    private Double weekendOverHour;    //周末加班
    private Double vocationOverHour;    //节假日加班
    private Double approvalDay;    //调休天数
    private Double wxLeaveDay;    //微信事假累计天数
    private String aliNumber;                       //外包工号
    private String employeeName;                   //姓名
    private String workNum;                         //工号
    @JsonSerialize(using = CustomDateSerializerList.class)
    private List<Date> jobPeriod;                  //当月在岗周期
    private int legalWorkingDay;                  //法定工作日
    private Double attendanceAays;                //实际出勤天数
    private Double weekOverHourApproval;         //不可调休工作日加班
    private Double weekendOverHourApproval;     //不可调休周末加班
    private Double vocationOverHourApproval;    //不可调休节假日加班
    private Double overHour;                      //调休小时
    private Double overDay;                       //调休天
    private Double leaveHour;                     //请假 小时
    private Double leaveDay;                      //请假天
    private Double wxLeaveHour;                   //微信请假小时
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date attendanceDate;                //日期
    private String attendanceDateMonth;          //年月 用来统计当月的出勤天数
    private String punchTime1;                  //上班打卡时间
    private String punchTime2;                  //下班打卡时间
    private String duration;                    //时长
    private String orders;                       //班次
    private String state;                        //状态描述
    private String punchComment1;              //上班打卡结果
    private String punchComment2;              //下班打卡结果
    private String approval;                    //关联的审批单
    private String belongsDept;                 //员工所属部门
    private Integer isDel;

    public void addWxLeaveHour(Double wxLeaveHour){
        if(wxLeaveHour==0.0){
            this.wxLeaveHour = wxLeaveHour;
        }else {
            this.wxLeaveHour += wxLeaveHour;
        }
    }
}

